package com.wc.alorithm_blue_bridge._容斥原理.智算士气;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/8 7:51
 * @description https://www.lanqiao.cn/problems/19779/learning/?page=1&first_category_id=1
 */
public class Main {
    /**
     * 思路：<p>
     * 唯一分解定理 + 补集<p>
     * x = /sum_1_k p[i]^a[i]<p>
     * 至少要满足p[i]的最高次一次a[i]<p>
     * 全部个数 (a[i] + 1) ^ n, 0 ~ a[i]<p>
     * 不含a[i], (a[i] ^ n, 0 ~ (a[i] - 1) <p>
     * res = res * (qmi(a[i] + 1, n) - qmi(a[i], n))<p>
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    private static final int P = 998244353;
    static int n, m;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        long res = 1;
        for (int i = 2; i <= m / i; i++) {
            if (m % i == 0) {
                int s = 0;
                while (m % i == 0) {
                    s++;
                    m /= i;
                }
                res = res * ((qmi(s + 1, n) - qmi(s, n)) % P + P) % P;
            }
        }
        if (m > 1) res = res * (qmi(2, n) - qmi(1, n) % P + P) % P;
        out.println(res);
        out.flush();
    }

    static long qmi(long a, int k) {
        long res = 1;
        while (k > 0) {
            if ((k & 1) == 1) res = res * a % P;
            a = a * a % P;
            k >>= 1;
        }
        return res;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
